
import { Effect, ImmerReducer, Reducer, Subscription } from 'umi';
import {getEdit} from '../services/index'
export interface IndexModelState {
    
}
export interface IndexModelType {
  namespace: 'editor';
  state: IndexModelState;
  effects: {
    getMark: Effect;
  };
  reducers: {
    save: Reducer<IndexModelState>;
  };
  subscriptions?: { setup: Subscription };
}

const IndexModel: IndexModelType = {
  namespace: 'editor',
  state: {
    marklist:{}
  },
  effects: {
    *getMark({ payload,type }, { call, put }) {
      // console.log('payload....',payload)
        let result = yield call(getEdit,payload.id)
        // console.log('result...',result)
        yield put({
          type:'save',
          payload:{
            marklist:result.data}
        })
    },
  },
  reducers: {
    save(state, action) {
      return {
        ...state,
        ...action.payload,
      };
    },
  }
};

export default IndexModel;